﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *
 **/

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Peter.Common.Interfaces;
using Peter.Common.Services;
using Peter.Common.Utilities;
using Peter.Ftp.Logic;

namespace Peter.Ftp.Tests.Logic
{
   /// <summary>
   /// Tests the peter ftp class.
   /// </summary>
   [TestClass]
   public class PeterFtpTests
   {
      /// <summary>
      /// Tests the peter ftp object.
      /// </summary>
      [TestMethod]
      public void TestPeterFtp ()
      {
         var peter = new MockPeter ();
         ServiceManager.AddSingleton<IPeter, MockPeter> (peter);
         ServiceManager.Add<IPeterOptions, MockOptions> ();
         using (var ftp = new PeterFtp ())
         {
            Assert.IsNotNull (ftp.FtpMenuItem);
            Assert.IsNotNull (ftp.FtpWindowCommand);
            Assert.IsNotNull (ftp.Ftp);
            ftp.FtpWindowCommand.Execute (null);
            Assert.IsTrue (ViewRegistry.Contains (typeof (ModelFtp)));
            Assert.AreEqual (peter.LastToolWindow, ftp.Ftp);
            peter.TriggerShuttingDown ();
         }
         ServiceManager.Clear ();
      }
   }
}
